#include <iostream>
using namespace std;

int main() {
    int firstNumber, secondNumber, sumOfTwoNumbers;
    cout << "输入两个整数: ";
    cin >> firstNumber >> secondNumber;

    // 相加
    sumOfTwoNumbers = firstNumber + secondNumber;
    cout << firstNumber << " + " <<  secondNumber << " = " << sumOfTwoNumbers;


    // 交换
    int a = firstNumber, b = secondNumber, temp;
    cout << "\n 交换之前：" << endl;
    cout << "a = " << a << ", b = " << b << endl;
    temp = a;
    a = b;
    b = temp;
    cout << "\n交换之后：" << endl;
    cout << "a = " << a << ", b = " << b << endl;

    // 最大公约数
    int n1 = firstNumber, n2 = secondNumber;
    while(n1 != n2) {
        if(n1 > n2)
            n1 -= n2;
        else
            n2 -= n1;
    }
    cout << "HCF（最大公约数） = " << n1;


    // 求两数最小公倍数
    cout << "\n " << endl;
    int n3 = firstNumber, n4 = secondNumber, max = 0;
    max = (n3 > n4) ? n3 : n4;
    do {
        if (max % n3 == 0 && max % n4 == 0) {
            cout << "LCM(最小公倍数) = " << max;
            break;
        }
        else
            ++max;
    } while (true);
    return 0;

}

